<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="../js/jquery-3.2.0.js"></script>
		<style type="text/css">
			img{
				width: 100px;
				height: 100px;
			}
			input{
				width: 100%;
				background: red;
			}
		</style>
	</head>
	<body>
		<input type="file" value="" class="imgInput" multiple/>
		<div>
			<img src="" class="img" style="width: 100px;height: 100px;"/>
		</div>
		
		<button>确定</button>
	</body>
</html>
<script type="text/javascript">
	$(".imgInput").change(function(e){
	    // $(".img").attr("src",URL.createObjectURL($(this)[0].files[0]));
		let file = $(".imgInput").val()
		console.log(file)
		alert(111111)
	});
	
//	var files = $('input').val()
//	
	
	
	
	
	$('button').click(function(){
		var files = $('input').prop('files')
		if(files.length == 0){
		  alert('请选择文件');
		  return;
		}else{
		  var reader = new FileReader();//新建一个FileReader
		  reader.readAsText(files[0], "UTF-8");//读取文件 
		  reader.onload = function(evt){ //读取完文件之后会回来这里
		    var fileString = evt.target.result;
		    form.vm.value = fileString; //设置隐藏input的内容
		  }
		}
	})
	
	
</script>

























